package com.ytjj.qmyx.mall.controller;

import com.ytjj.common.utils.HttpClientUtil;
import com.ytjj.qmyx.mall.config.SupplyApiConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/address")
@Slf4j
public class AddressController {

    @Autowired
    private SupplyApiConfig supplyApiConfig;

    /**
     * H5获取地址接口
     * @return
     */
    @GetMapping("/getH5Address")
    public String getH5Address() {
        String resultJson = HttpClientUtil.doGet(supplyApiConfig.getUrl() + "/banker/getH5Address", null, supplyApiConfig.getHeadsMap());
        return resultJson;
    }

    /**
     * ios获取地址接口
     * @return
     */
    @GetMapping("/getIOSAddress")
    public String getIOSAddress() {
        String resultJson = HttpClientUtil.doGet(supplyApiConfig.getUrl() + "/banker/getIOSAddress", null, supplyApiConfig.getHeadsMap());
        return resultJson;
    }

    /**
     * 安卓获取地址
     * @return
     */
    @GetMapping("/getAndroidAddress")
    public String getAndroidAddress() {
        String resultJson = HttpClientUtil.doGet(supplyApiConfig.getUrl() + "/banker/getAndroidAddress", null, supplyApiConfig.getHeadsMap());
        return resultJson;
    }

    /**
     * 省市区地址
     * @return
     */
    @GetMapping("/getAllAddress")
    public String getAllAddress() {
        String resultJson = HttpClientUtil.doGet(supplyApiConfig.getUrl() + "/banker/getAllAddress", null, supplyApiConfig.getHeadsMap());
        return resultJson;
    }
}
